home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
201-225
/
disk_224
/
xebec
/
parx.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-05-06
|
3KB
|
82 lines
/* The idea here is to write a replacement for the cumbersome Xebec Park
program. This is a tiny convenient program which will park the heads of your
Xebec hard disk. At first I made it so that if you have more than one disk
on your scsi controller, it would attempt to park all of them, but then I made
it simply assume that it should park unit 0. Later I might add command line /
tool type selection of which to park. By Paul Kienitz 2/89, public domain.
Thanks to Matt Dillon for TDebug, which showed me what request the Xebec
scsi.device task considers to mean "park" (after I went through about 47
modified versions of TDebug to find all the necessary data, and ended up
disassembling Xebec's Park anyway). The Park program puts some pretty weird
shit in the io_Unit field of the IO request.
*/
#include <exec/io.h>
#include <devices/trackdisk.h>
#include <libraries/dos.h>
#include <functions.h>
#include <Paul.h>
#define Unit 0L
long _main() /* use of _main instead of main is Aztec-ism */
{
struct IOExtTD q;
# define qr q.iotd_Req
# define qrm qr.io_Message
# define qrmn qrm.mn_Node
register str *lp;
register struct Process *me = (adr) FindTask(null);
char foo[600];
str Unitstruct[6];
short fooset;
adr mess = null, port = null;
long hair = 0;
setmem(&q, sizeof(struct IOExtTD), 0);
setmem(foo, 600, 0);
if (!me->pr_CLI) {
WaitPort(&me->pr_MsgPort);
mess = GetMsg(&me->pr_MsgPort);
}
if (port = CreatePort(null, 0L)) {
qrmn.ln_Pri = 0;
qrm.mn_ReplyPort = port;
if (!OpenDevice("scsi.device", Unit, &q, 0L)) {
qrmn.ln_Type = NT_MESSAGE;
qrm.mn_Length = 48;
qr.io_Command = TD_RAWREAD;
qr.io_Length = 0;
qr.io_Offset = 0;
qr.io_Data = 0;
qr.io_Flags = 0;
lp = Unitstruct;
qr.io_Unit = (adr) lp;
fooset = ((long) foo & 1) != 0;
lp[1] = foo + 10 + fooset;
lp[2] = lp[1] - 1; /* this doesn't mean anything */
lp[3] = lp[1] - 2; /* to me, who knows why to do this? */
lp[0] = lp[3] + 512; /* who knows if 512 is necessary? */
lp[0][0] = 17; /* THIS IS ESSENTIAL */
lp[1][0] = 0; /* i don't know */
lp[2][0] = 0;
lp[3][0] = 0;
lp[4] = Unit;
lp[5] = 0;
if (DoIO(&q))
hair = ERROR_SEEK_ERROR; /* closest approximation */
CloseDevice(&q);
} else hair = ERROR_DEVICE_NOT_MOUNTED; /* sort of the right idea */
} else hair = ERROR_NO_FREE_STORE; /* almost certainly correct */
if (port) DeletePort(port);
if (mess) {
Forbid();
ReplyMsg(mess);
}
me->pr_Result2 = hair;
return (hair == 0 ? 0L : 10L);
/* Well, heck. I don't know how to tell the Workbench to beep the screen
and record the "Last Error". */
}